# -*- coding: utf-8 -*-
# @Time : 2022/5/14 00:45
# @Author : cheney
# @File : socket_test_b.py
# @Software: PyCharm
# @Site: www.cheney.cc

import mysocket
import socket
import packet
import des2
import rsa2
import socket_test_a

publicKey, privateKey = socket_test_a.publicKey, socket_test_a.privateKey
sessionKey = socket_test_a.sessionKey

sock_ = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
address_as = ("127.0.0.1", socket_test_a.a_port)

# 开始连接AS服务器
sock_.connect(address_as)
print("连接到server")
sendd = ""
# sock_.send(sendd.encode())

# c_ = input("请输入：")
# # sock_.send(str(c_).encode())
# mysocket.send(sock_, c_.encode())

# mes = sock_.recv(1024)
b = mysocket.recv(sock_, sessionkey=11651596744076885038, publickey=publicKey, piece_size=1024,ack_flag=True)
# print("从socket收取长度：", len(mes))

# b = packet.pack(mes)
print("b.length", b.length)
print("b.total_length", b.total_length)
# print("int(mes[120:144], 2)", int(mes[144:168], 2))

# b = packet.pack(mes, sessionkey=sessionKey, publickey=publicKey)
